package com.cy.config;


import com.cy.interceptors.JWTInterceptors;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptors())
                .addPathPatterns("/usercourses/**","/schoolinfo/**")  // 拦截的路径
                .excludePathPatterns("/users/UserLogin","/users/UserRegister","/users/forgetPwd");  // 所有用户登录注册重置密码都放行的路径
    }
}
